Minor fix in cursor positioning on wrapped lines.

This commit is contained in:
Martín Lucas Golini
2024-06-09 01:20:04 -03:00
parent 5e6e3343a8
commit 819c1a767f
2 changed files with 3 additions and 8 deletions

View File

@@ -10,7 +10,6 @@
#include <eepp/system/pack.hpp>
#include <eepp/system/packmanager.hpp>
#include <eepp/system/scopedbuffer.hpp>
#include <memory>
namespace EE { namespace Audio {

View File

@@ -3061,7 +3061,7 @@ void UICodeEditor::jumpLinesUp( int offset ) {
void UICodeEditor::jumpLinesDown( int offset ) {
for ( size_t i = 0; i < mDoc->getSelections().size(); ++i ) {
TextPosition position = mDoc->getSelections()[i].start();
if ( position.line() >= (Int64)mDoc->linesCount() - offset ) {
if ( position.line() >= (Int64)mDocView.getVisibleLinesCount() - offset ) {
mDoc->setSelection( i, mDoc->endOfDoc(), mDoc->endOfDoc() );
} else {
mDoc->moveTo( i, moveToLineOffset( position, offset, i ) );
@@ -3081,18 +3081,14 @@ void UICodeEditor::jumpLinesDown() {
void UICodeEditor::selectToPreviousLine() {
for ( size_t i = 0; i < mDoc->getSelections().size(); ++i ) {
TextPosition position = mDoc->getSelectionIndex( i ).start();
if ( position.line() == 0 ) {
mDoc->selectTo( i, mDoc->startOfDoc() );
} else {
mDoc->selectTo( i, moveToLineOffset( position, -1 ) );
}
mDoc->selectTo( i, moveToLineOffset( position, -1 ) );
}
}
void UICodeEditor::selectToNextLine() {
for ( size_t i = 0; i < mDoc->getSelections().size(); ++i ) {
TextPosition position = mDoc->getSelectionIndex( i ).start();
if ( position.line() == (Int64)mDoc->linesCount() - 1 ) {
if ( position.line() == (Int64)mDocView.getVisibleLinesCount() - 1 ) {
mDoc->selectTo( i, mDoc->endOfDoc() );
} else {
mDoc->selectTo( i, moveToLineOffset( position, 1 ) );