|
|
@@ -156,7 +156,7 @@ protected:
|
|
|
// Safety check - don't draw if core is null (during destruction)
|
|
|
if (!core_) return;
|
|
|
|
|
|
- const auto cursor = core_->cursor();
|
|
|
+ const auto cursor = core_->active_window()->cursor();
|
|
|
|
|
|
// Fill background
|
|
|
auto theme = core_->active_theme();
|
|
|
@@ -233,37 +233,8 @@ protected:
|
|
|
const auto& cursor_line_text = buffer.line(buffer_line_idx);
|
|
|
|
|
|
// Calculate the exact X position by measuring text up to cursor position
|
|
|
- double cursor_screen_x = PADDING_LEFT;
|
|
|
+ double cursor_screen_x = PADDING_LEFT + (static_cast<int>(cursor.column) - horizontal_offset) * char_width_;
|
|
|
|
|
|
- // If we have horizontal scrolling, we need to account for the visible portion
|
|
|
- if (horizontal_offset > 0 && cursor.column >= static_cast<size_t>(horizontal_offset)) {
|
|
|
-
|
|
|
- // Measure text from horizontal_offset to cursor position
|
|
|
- if (horizontal_offset < static_cast<int>(cursor_line_text.length())) {
|
|
|
- std::string text_to_cursor = cursor_line_text.substr(
|
|
|
- horizontal_offset,
|
|
|
- cursor.column - horizontal_offset
|
|
|
- );
|
|
|
- if (!text_to_cursor.empty()) {
|
|
|
- layout->set_text(text_to_cursor);
|
|
|
- Pango::Rectangle text_rect;
|
|
|
- layout->get_pixel_extents(text_rect, text_rect);
|
|
|
- cursor_screen_x = PADDING_LEFT + text_rect.get_width();
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (horizontal_offset == 0) {
|
|
|
- // No horizontal scrolling - measure from start of line to cursor
|
|
|
- if (cursor.column > 0 && cursor.column <= cursor_line_text.length()) {
|
|
|
- std::string text_to_cursor = cursor_line_text.substr(0, cursor.column);
|
|
|
- layout->set_text(text_to_cursor);
|
|
|
- Pango::Rectangle text_rect;
|
|
|
- layout->get_pixel_extents(text_rect, text_rect);
|
|
|
- cursor_screen_x = PADDING_LEFT + text_rect.get_width();
|
|
|
- }
|
|
|
- } else {
|
|
|
- // Cursor is before the visible area (shouldn't happen with proper scrolling)
|
|
|
- cursor_screen_x = -char_width_; // Hide cursor
|
|
|
- }
|
|
|
|
|
|
// Only render cursor if it's visible horizontally
|
|
|
if (cursor_screen_x >= PADDING_LEFT && cursor_screen_x < (width - PADDING_RIGHT)) {
|
|
|
@@ -364,6 +335,7 @@ protected:
|
|
|
// 1. Resolve the base key name
|
|
|
std::string key_name = resolve_key(keyval, state);
|
|
|
if (key_name.empty()) return false;
|
|
|
+
|
|
|
|
|
|
// 2. Handle Modifiers
|
|
|
unsigned int state_uint = static_cast<unsigned int>(state);
|