diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-16 13:35:40 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-16 13:35:40 +0100 |
commit | ba22b1a307988fd493fc682daff20eee4c325451 (patch) | |
tree | 7c2e482a07c8c8c0444ae8f0fa4757f3da50acfc /src | |
parent | 4ae59fd5cdcaba4d050e86d02c38dddacba2fc80 (diff) | |
download | sciteco-ba22b1a307988fd493fc682daff20eee4c325451.tar.gz |
updated minimum required Scintilla version to v3.3.7 / Scinterm v1.2
* allows us to remove most patches. One however is still necessary
(Scinterm Makefile bug!)
* TECO-style control code echoing is now set up using the SCI_SETREPRESENTATION message
* updated copyrights
* updated TODO
Diffstat (limited to 'src')
-rw-r--r-- | src/document.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp index a7276f0..c01bd4c 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -28,6 +28,32 @@ #include "undo.h" #include "document.h" +static inline void +set_representations(void) +{ + static const char *reps[] = { + "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", + "^H", "TAB" /* ^I */, "LF" /* ^J */, "^K", "^L", "CR" /* ^M */, "^N", "^O", + "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", + "^X", "^Y", "^Z", "$" /* ^[ */, "^\\", "^]", "^^", "^_" + }; + + for (guint cc = 0; cc < G_N_ELEMENTS(reps); cc++) { + gchar buf[] = {(gchar)cc, '\0'}; + interface.ssm(SCI_SETREPRESENTATION, + (uptr_t)buf, (sptr_t)reps[cc]); + } +} + +class UndoSetRepresentations : public UndoToken { +public: + void + run(void) + { + set_representations(); + } +}; + void TECODocument::edit(void) { @@ -38,11 +64,24 @@ TECODocument::edit(void) interface.ssm(SCI_SETFIRSTVISIBLELINE, first_line); interface.ssm(SCI_SETXOFFSET, xoffset); interface.ssm(SCI_SETSEL, anchor, (sptr_t)dot); + + /* + * Default TECO-style character representations. + * They are reset on EVERY SETDOCPOINTER call by Scintilla. + */ + set_representations(); } void TECODocument::undo_edit(void) { + /* + * see above: set TECO-style character representations + * NOTE: could be done with push_msg() but that requires + * making the entire mapping static constant + */ + undo.push(new UndoSetRepresentations()); + undo.push_msg(SCI_SETSEL, anchor, (sptr_t)dot); undo.push_msg(SCI_SETXOFFSET, xoffset); undo.push_msg(SCI_SETFIRSTVISIBLELINE, first_line); |