View Issue Details

IDProjectCategoryView StatusLast Update
0020053LazarusOtherpublic2011-08-26 02:46
ReporterFlávio Etrusco Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.9.31 (SVN) 
Fixed in Version0.9.31 (SVN) 
Summary0020053: SynEdit scrolls by one less (char) if caret is beyond MaxLeftChar
DescriptionActually the scroll range is one less than it should.

How to reproduce:
Type something in a SynEdit, copy to clipboard and do several pastes. While the caret is smaller than MaxleftChar (1024 by default) the editor scrolls to EOL and caret is shown. When caretX is greater than MaxleftChar then the caret doesn't show (goes one char beyond scroll range).
TagsNo tags attached.
Fixed in Revision32058
Attached Files


Martin Friebe

2011-08-25 20:00

manager   ~0051127

Last edited: 2011-08-25 20:00

Unfortunately I can not reproduce.

Please attach your EditorOptions.xml to ensure it is not setting related.

* To explain what I understand.

editor left border: [
editor right border:]
Caret: |

the first visible char in the line is the 1025th char of the line
[c1025 foo bar text ... foo]b|ar

"bar" is not yet visible, but the caret (according to the status bar info, is located in "bar" and hence the caret is not in the visible scree area?

* A few more questions:

- You are moving the caret on a line, that has itself more than 1024 chars. So the caret is not past-end-of-line when the issue occurs?
- Does it also occur if you move the caret on the past-eol space of a shorter line?
- does it change depending on the caret type (overwrite vs insert caret)?
- The line is made of only a-z0-9 space? No tabs, no accented or umlauted or other special chars?

2011-08-25 23:09


editoroptions.xml (3,306 bytes)   
<?xml version="1.0"?>
  <EditorOptions Version="7">
      <default Count="17">
        <Version Value="6"/>
        <Item1 Name="Close">
          <KeyB Default="False" Key1="87" Shift1="1"/>
          <KeyA Default="False" Key1="115" Shift1="1"/>
        <Item2 Name="Comment selection">
          <KeyA Default="False"/>
        <Item3 Name="Delete to end of word">
          <KeyA Default="False" Key1="84" Shift1="1"/>
          <KeyB Default="False" Key1="46" Shift1="1"/>
        <Item4 Name="Find next word occurrence">
          <KeyA Default="False" Key1="114" Shift1="1"/>
        <Item5 Name="Find previous word occurrence">
          <KeyA Default="False" Key1="114" Shift1="3"/>
        <Item6 Name="Next Bookmark">
          <KeyA Default="False" Key1="75" Shift1="1" Key2="78" Shift2="1"/>
        <Item7 Name="Previous Bookmark">
          <KeyA Default="False" Key1="75" Shift1="1" Key2="80" Shift2="1"/>
        <Item8 Name="Remove empty methods">
          <KeyA Default="False" Key1="69" Shift1="3"/>
        <Item9 Name="Rename identifier">
          <KeyB Default="False"/>
          <KeyA Default="False" Key1="113"/>
        <Item10 Name="Select word">
          <KeyA Default="False" Key1="75" Shift1="1" Key2="84" Shift2="1"/>
        <ExternalToolCount Value="1"/>
        <Item11 Name="Set free Bookmark">
          <KeyA Default="False" Key1="75" Shift1="1" Key2="77" Shift2="1"/>
        <Item12 Name="Show execution point">
          <KeyA Default="False" Key1="113" Shift1="4"/>
        <Item13 Name="Toggle comment">
          <KeyA Default="False" Key1="193" Shift1="1"/>
          <KeyB Default="False" Key1="191" Shift1="1"/>
        <Item14 Name="Toggle view Code Explorer">
          <KeyA Default="False" Key1="79" Shift1="6"/>
        <Item15 Name="Uncomment selection">
          <KeyA Default="False"/>
        <Item16 Name="Unindent block">
          <KeyB Default="False" Key1="9" Shift1="2"/>
        <Item17 Name="Word completion">
          <KeyA Default="False" Key1="87" Shift1="3"/>
    <CodeTools CodeTemplateFileName="C:\Users\etrusco\AppData\Local\lazarus\lazarus.dci" CompletionLongLineHintTypeCompletionLongLineHintType="sclpExtendRightOnly"/>
    <Color Version="7">
      <LangObjectPascal Version="7">
          <Number Foreground="clTeal"/>
          <Comment Foreground="clMedGray"/>
      <Editor EnhanceHomeKey="True" HalfPageScroll="False" KeepCaretX="True" ScrollPastEol="False" CaretSkipTab="True" EnhanceEndKey="True" TabWidth="2" CopyWordAtCursorOnCopyNone="False" UndoAfterSave="False" TabIndent="True" SmartTabs="False"/>
    <Display DisableAntialiasing="True">
      <MarkupCurrentWord FullLen="30"/>
    <Misc UseTabHistory="True"/>
editoroptions.xml (3,306 bytes)   

Flávio Etrusco

2011-08-25 23:27

developer   ~0051141

Last edited: 2011-08-25 23:30

Oops. Sorry for the faulty description. The problem happens when the Caret is at LengthOfLongestLine +1.
Ex. write a single line longer than MaxLeftChar (1024) and press 'End'. Here it scrolls to the point where last line char is at the last visible "column", there's no extra column for the caret to show, and it's not visible (I assume it's at the correct position, but out of the scroll range).
It also happens when you have another line of the same length (> 1024).

1&2) I hope the above answers EOL matters.
3) To my surprise, changing the caret type to 'overwrite' fixes the scroll range.
4) Yes. Actually I just pasted lots of "SynEdit1 " from the default text :)

Martin Friebe

2011-08-25 23:46

manager   ~0051144

Ok, I was able to reproduce. The trick is to size the editor window on the pixel exactly to a full char.
With a randomly sized window, I always got to see a half char at the end.

Martin Friebe

2011-08-26 01:08

manager   ~0051145

The issue consists of 2 problems:

1) The caret obeys the editors text area as cliprect. This is in case of a gutter on the right side. It would be wrong if the caret (especially "overwrite") would be displayed on the gutter. This clipping should only be needed if the synedit can not scroll, that would be, if the width of the text area is smaller than one char.
This cliprect was one pixel to small. So it over-clipped the caret.
This is fixed in r32056. You will now see half a caret at the end of the line

2) For the "insert" caret, normally no extra space is provided, as it usually fits on the "half visible char" at the end of the line (it only needs one pixel of this.
Of course that doesn't work if, the client rect is exactly sized to a multiply of charwidth.
Since the caret is displayed half and half on the 2 surrounding chars, with the over-clipping of 1 fixed, this displays half a caret. (still need fixing)

The "override" caret always needs a full extra char. That is why it works.

Martin Friebe

2011-08-26 01:47

manager   ~0051146

Fixed in r32058

Please test and close if ok

Flávio Etrusco

2011-08-26 02:46

developer   ~0051147

Thanks, verified :)

Issue History

Date Modified Username Field Change
2011-08-25 19:38 Flávio Etrusco New Issue
2011-08-25 19:38 Flávio Etrusco LazTarget => -
2011-08-25 19:38 Flávio Etrusco Widgetset => Win32/Win64
2011-08-25 19:44 Martin Friebe Status new => assigned
2011-08-25 19:44 Martin Friebe Assigned To => Martin Friebe
2011-08-25 20:00 Martin Friebe Note Added: 0051127
2011-08-25 20:00 Martin Friebe Status assigned => feedback
2011-08-25 20:00 Martin Friebe Note Edited: 0051127
2011-08-25 23:09 Flávio Etrusco File Added: editoroptions.xml
2011-08-25 23:27 Flávio Etrusco Note Added: 0051141
2011-08-25 23:30 Flávio Etrusco Note Edited: 0051141
2011-08-25 23:46 Martin Friebe LazTarget - => 1.0
2011-08-25 23:46 Martin Friebe Note Added: 0051144
2011-08-25 23:46 Martin Friebe Status feedback => assigned
2011-08-26 01:08 Martin Friebe Note Added: 0051145
2011-08-26 01:47 Martin Friebe Fixed in Revision => 32058
2011-08-26 01:47 Martin Friebe Status assigned => resolved
2011-08-26 01:47 Martin Friebe Fixed in Version => 0.9.31 (SVN)
2011-08-26 01:47 Martin Friebe Resolution open => fixed
2011-08-26 01:47 Martin Friebe Note Added: 0051146
2011-08-26 01:47 Martin Friebe Target Version => 0.99.0
2011-08-26 02:46 Flávio Etrusco Status resolved => closed
2011-08-26 02:46 Flávio Etrusco Note Added: 0051147