diff options
Diffstat (limited to '')
-rw-r--r-- | bin/man/psfed.1 | 7 | ||||
-rw-r--r-- | bin/psfed.c | 26 |
2 files changed, 26 insertions, 7 deletions
diff --git a/bin/man/psfed.1 b/bin/man/psfed.1 index a0e07c75..59fbdbe7 100644 --- a/bin/man/psfed.1 +++ b/bin/man/psfed.1 @@ -61,6 +61,13 @@ Select previous/next glyph. .It Ic k Ic j Select glyph in previous/next row. . +.It Ic y +Copy the selected glyph. +. +.It Ic p +Paste the copied glyph +over the selected glyph. +. .It Ic e Edit the selected glyph in .Sx Edit Mode . diff --git a/bin/psfed.c b/bin/psfed.c index 93e77002..dde47e77 100644 --- a/bin/psfed.c +++ b/bin/psfed.c @@ -248,6 +248,7 @@ static struct { uint32_t scale; uint32_t index; bool modified; + uint8_t *copy; } normal; static struct { @@ -278,11 +279,11 @@ static void normalDec(uint32_t n) { static void normalInc(uint32_t n) { if (normal.index + n < header.glyph.len) normal.index += n; } -static void normalPrint(void) { +static void normalPrint(const char *prefix) { if (normal.index <= 256) { - printf("index: %02X '%lc'\n", normal.index, CP437[normal.index]); + printf("%s: %02X '%lc'\n", prefix, normal.index, CP437[normal.index]); } else { - printf("index: %02X\n", normal.index); + printf("%s: %02X\n", prefix, normal.index); } } @@ -299,10 +300,21 @@ static void inputNormal(char ch) { } break; case '-': if (normal.scale) normal.scale--; frameClear(); break; case '+': normal.scale++; - break; case 'h': normalDec(1); normalPrint(); - break; case 'l': normalInc(1); normalPrint(); - break; case 'k': normalDec(NormalCols); normalPrint(); - break; case 'j': normalInc(NormalCols); normalPrint(); + break; case 'h': normalDec(1); normalPrint("index"); + break; case 'l': normalInc(1); normalPrint("index"); + break; case 'k': normalDec(NormalCols); normalPrint("index"); + break; case 'j': normalInc(NormalCols); normalPrint("index"); + break; case 'y': { + if (!normal.copy) normal.copy = malloc(header.glyph.size); + if (!normal.copy) err(EX_OSERR, "malloc"); + memcpy(normal.copy, glyph(normal.index), header.glyph.size); + normalPrint("copy"); + } + break; case 'p': { + if (!normal.copy) break; + normal.modified = true; + memcpy(glyph(normal.index), normal.copy, header.glyph.size); + } break; case 'e': { normal.modified = true; edit.index = normal.index; |