mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: CTRL + A not selecting last line in the text editor
This commit is contained in:
@@ -472,6 +472,8 @@ int TextEditor::GetCharacterIndex(const Coordinates &aCoordinates) const {
|
||||
int TextEditor::GetCharacterColumn(int aLine, int aIndex) const {
|
||||
if (aLine >= mLines.size())
|
||||
return 0;
|
||||
if (aLine < 0)
|
||||
return 0;
|
||||
auto &line = mLines[aLine];
|
||||
int col = 0;
|
||||
int i = 0;
|
||||
@@ -498,6 +500,8 @@ int TextEditor::GetStringCharacterCount(std::string str) const {
|
||||
int TextEditor::GetLineCharacterCount(int aLine) const {
|
||||
if (aLine >= mLines.size())
|
||||
return 0;
|
||||
if (aLine < 0)
|
||||
return 0;
|
||||
auto &line = mLines[aLine];
|
||||
int c = 0;
|
||||
for (unsigned i = 0; i < line.size(); c++)
|
||||
@@ -508,6 +512,8 @@ int TextEditor::GetLineCharacterCount(int aLine) const {
|
||||
unsigned long long TextEditor::GetLineByteCount(int aLine) const {
|
||||
if (aLine >= mLines.size())
|
||||
return 0;
|
||||
if (aLine < 0)
|
||||
return 0;
|
||||
auto &line = mLines[aLine];
|
||||
return line.size();
|
||||
}
|
||||
@@ -515,6 +521,8 @@ unsigned long long TextEditor::GetLineByteCount(int aLine) const {
|
||||
int TextEditor::GetLineMaxColumn(int aLine) const {
|
||||
if (aLine >= mLines.size())
|
||||
return 0;
|
||||
if (aLine < 0)
|
||||
return 0;
|
||||
auto &line = mLines[aLine];
|
||||
int col = 0;
|
||||
for (unsigned i = 0; i < line.size();) {
|
||||
@@ -2011,7 +2019,10 @@ void TextEditor::SelectWordUnderCursor() {
|
||||
}
|
||||
|
||||
void TextEditor::SelectAll() {
|
||||
SetSelection(Coordinates(0, 0), Coordinates((int)mLines.size(), 0));
|
||||
if (isEmpty())
|
||||
return;
|
||||
|
||||
SetSelection(Coordinates(0, 0), Coordinates((int)mLines.size(), mLines.empty() ? 0 : GetLineMaxColumn((int)mLines.size() - 1)));
|
||||
}
|
||||
|
||||
bool TextEditor::HasSelection() const {
|
||||
|
||||
Reference in New Issue
Block a user