Uploaded image for project: 'Aesh'
  1. Aesh
  2. AESH-475

Cursor position with a blank prompt is incorrect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.7
    • 1.8
    • None
    • None
    • Hide
      1. git clone https://github.com/aeshell/aesh-readline.git
      2. git checkout 1.9
      3. apply following patch to examples/src/main/java/examples/Example.java : https://pastebin.com/FRbDa4FN
      4. mvn clean install
      5. java -jar target/readline-examples-1.9.jar

      Once the example is started

      1. type some input, such as "thisissomeinput"
      2. press the 'home' key
      3. observe that the cursor stops 1 character from the beginning of input. Pressing left arrow key does not move the cursor further to the left
      4. press 'end' key
      5. cursor moves to one space beyond input
      6. rapidly press 'home' and 'end'
      7. the 'boundary' of the cursor will shift by 1 character each time the above sequence is repeated.
      Show
      git clone https://github.com/aeshell/aesh-readline.git git checkout 1.9 apply following patch to examples/src/main/java/examples/Example.java : https://pastebin.com/FRbDa4FN mvn clean install java -jar target/readline-examples-1.9.jar Once the example is started type some input, such as "thisissomeinput" press the 'home' key observe that the cursor stops 1 character from the beginning of input. Pressing left arrow key does not move the cursor further to the left press 'end' key cursor moves to one space beyond input rapidly press 'home' and 'end' the 'boundary' of the cursor will shift by 1 character each time the above sequence is repeated.

    Description

      I built using the latest 1.9 tag.

      When using an empty Prompt (new Prompt(""), the cursor location becomes incorrect if the user uses 'home' key (off by 1).

      Possible fixes:
      in aesh.readline.Buffer.java, syncCursor method, the following snippet exists:

              if(newPos < 1)
                  newPos = 1;
      

      I experimented with changing this to:

              if(newPos < 0)
                  newPos = 0;
      

      and this did resolve this particular issue. However, the repercussions of such a change are not apparent to me

      Attachments

        Issue Links

          Activity

            People

              spederse@redhat.com Stale Pedersen
              thauser_jira Thomas Hauser (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: