Skip to content

Commit

Permalink
Fix getMousePosField when no file opened
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlin96069 committed Jan 19, 2024
1 parent 8c13b08 commit 9100050
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ enum EditorHighlightBg {
};

enum EditorField {
FIELD_EMPTY,
FIELD_TOP_STATUS,
FIELD_TEXT,
FIELD_LINENO,
Expand Down
2 changes: 2 additions & 0 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ int getMousePosField(int x, int y) {
return FIELD_STATUS;
if (x < gEditor.explorer.width)
return FIELD_EXPLORER;
if (gEditor.file_count == 0)
return FIELD_EMPTY;
if (x < gEditor.explorer.width + gCurFile->lineno_width)
return FIELD_LINENO;
return FIELD_TEXT;
Expand Down

0 comments on commit 9100050

Please sign in to comment.