aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-02-19 01:15:25 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-02-19 01:15:25 +0100
commitc7b2da8c041fec7637204620b0970c2c91d76d19 (patch)
tree564f497713d1bb6802ef3233a10b63f8f5e1f002
parent2900fcbb73b9f80f9a29adef6b0604e362c215c7 (diff)
downloadsciteco-c7b2da8c041fec7637204620b0970c2c91d76d19.tar.gz
work around Scintilla character representation drawing bug
* since SCI_SETDOCPOINTER resets character representations (should probably be submitted as a bug to Scintilla) we have to reset the representations each time we load a q-register into the q-reg view. * since the SCI_SETREPRESENTION call does not do any redrawing (and it would be very slow if it did), the lines with control characters were laid out wrong (too much spaces). This happened when editing a q-reg or the command-line. * Since it is not obvious how to fix Scintilla's behaviour here, we work around the issue by temporarily disabling the layout cache.
-rw-r--r--src/document.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp
index 27b418c..129914d 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -33,8 +33,22 @@ namespace SciTECO {
void
Document::edit(ViewCurrent &view)
{
+ /*
+ * FIXME: SCI_SETREPRESENTATION does not redraw
+ * the screen - also that would be very slow.
+ * Since SCI_SETDOCPOINTER resets the representation
+ * (this should probably be fixed in Scintilla),
+ * the screen is garbled since the layout cache
+ * is calculated with the default representations.
+ * We work around this by temporarily disabling the
+ * layout cache.
+ */
+ gint old_mode = view.ssm(SCI_GETLAYOUTCACHE);
+
maybe_create_document();
+ view.ssm(SCI_SETLAYOUTCACHE, SC_CACHE_NONE);
+
view.ssm(SCI_SETDOCPOINTER, 0, (sptr_t)doc);
view.ssm(SCI_SETFIRSTVISIBLELINE, first_line);
view.ssm(SCI_SETXOFFSET, xoffset);
@@ -45,6 +59,8 @@ Document::edit(ViewCurrent &view)
* They are reset on EVERY SETDOCPOINTER call by Scintilla.
*/
view.set_representations();
+
+ view.ssm(SCI_SETLAYOUTCACHE, old_mode);
}
void