typedb-studio icon indicating copy to clipboard operation
typedb-studio copied to clipboard

Store cursor position when changing lines

Open jamesreprise opened this issue 2 years ago • 1 comments

What is the goal of this PR?

We store cursor positions when changing lines as described in https://github.com/vaticle/typedb-studio/issues/748. This is standard behaviour in other IDEs, such as IntelliJ IDEA and VSCode.

Before:

https://github.com/vaticle/typedb-studio/assets/51956016/9a4232b2-fb41-4276-9b48-76d741143329

After:

https://github.com/vaticle/typedb-studio/assets/51956016/0f311437-15f4-4a66-96d8-0005dedc6ad7

What are the changes implemented in this PR?

We store an additional piece of data in Cursor, lastCol. This remembers the last position of the column, which we only forget upon the creation of a new cursor by a method other than moving up or down a line.

Additional info

Closes https://github.com/vaticle/typedb-studio/issues/748

jamesreprise avatar Jun 18 '23 16:06 jamesreprise

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

  • [x] This change is trivial and does not require a code or architecture review.

Code

  • [ ] Packages, classes, and methods have a single domain of responsibility.
  • [ ] Packages, classes, and methods are grouped into cohesive and consistent domain model.
  • [ ] The code is canonical and the minimum required to achieve the goal.
  • [ ] Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
  • [ ] Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
  • [ ] The code is algorithmically efficient and scalable for the whole application.

Architecture

  • [ ] Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
  • [ ] Any required build and release automations are updated and/or implemented.
  • [ ] Any new components follows a consistent style with respect to the pre-existing codebase.
  • [ ] The architecture intuitively reflects the application domain, and is easy to understand.
  • [ ] The architecture has a well-defined hierarchy of encapsulated components.
  • [ ] The architecture is extensible and scalable.

typedb-bot avatar Jun 18 '23 16:06 typedb-bot