[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] cursor movement with text styles
From: |
Michael Lachmann |
Subject: |
[Texmacs-dev] cursor movement with text styles |
Date: |
Thu, 11 Aug 2011 22:57:45 +0200 |
Hi,
As I mentioned before, I implemented some kind of syntax highlighting in the R
TeXmacs module. Now I'm using it, and I noticed something somewhat annoying.
The highlighting is implemented by embedding TeXmacs colors into the R code as
it is displayed. But what happens is that then when I move the cursor in the
code, there is one additional cursor movement needed for every color change.
Because of this, editing the code becomes a bit tedious... is this extra cursor
movement really necessary? I guess it is so that you can continue with or
without every style. But isn't it possible to just define a consistent pattern?
For example, when you go from one style to another, then at the boundary you
take the next style. Of course it gets more complicated when you are at the
boundary of several styles.
Or one could have special movement keys that allow fine movement.
When TeXmacs does the highlighting itself, no styles are used.. text is just
rendered automatically with different colors - for example in displaying scheme
code. Then cursor movement is fluid.
For example, try to paste the following into a TeXmacs buffer...
-----
<\verbatim>
read.LnS.sample = \
<with|color|#006|function><with|color|#006|(><with|color|#1A1|filename><with|color|#006|)>
<with|color|#006|{>
\ \ \ \ con <with|color|#447|=>
<with|color|#209|gzfile><with|color|#006|(>filename<with|color|#006|)>
\ \ \ \
a<with|color|#447|=><with|color|#209|readChar><with|color|#006|(>con<with|color|#006|,><with|color|#11D|10><with|color|#006|^><with|color|#11D|9>,useBytes=T<with|color|#006|)>
\ \ \ \ <with|color|#209|close><with|color|#006|(>con<with|color|#006|)>
\ \ \ \
b<with|color|#447|=><with|color|#209|strsplit><with|color|#006|(>a<with|color|#006|,><with|color|#500|"\\n">,fixed=T,useBytes=T<with|color|#006|)>[[1]]
\ \ \ \
bb<with|color|#447|=>strsplit(b<with|color|#006|,><with|color|#080|split><with|color|#080|=><with|color|#500|"
">,fixed=T,useBytes=T<with|color|#006|)>
\ \ \ \
d<with|color|#447|=>bb<with|color|#006|[><with|color|#11D|3><with|color|#006|:><with|color|#11D|7><with|color|#006|]>
\ \ \ \
dd<with|color|#447|=><with|color|#209|matrix><with|color|#006|(><with|color|#209|as.numeric><with|color|#006|(><with|color|#209|unlist><with|color|#006|(>d<with|color|#006|)><with|color|#006|)><with|color|#006|,><with|color|#080|nrow><with|color|#080|=><with|color|#209|length><with|color|#006|(>d<with|color|#006|[[><with|color|#11D|1><with|color|#006|]><with|color|#006|]><with|color|#006|)><with|color|#006|)><with|color|#006|[><with|color|#006|-><with|color|#11D|1><with|color|#006|,><with|color|#006|]>
\ \ \ \ dd
<with|color|#006|}>
</verbatim>
----
and try to edit the code :)
Michael
- [Texmacs-dev] cursor movement with text styles,
Michael Lachmann <=