[smuxi] Frontend-GNOME: restore cursor position in MessageTextView
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Frontend-GNOME: restore cursor position in MessageTextView
- Date: Sat, 4 Nov 2017 12:41:25 +0000 (UTC)
commit 22be95388e0aaae195538a62c8637f91db888692
Author: Mirco Bauer <meebey meebey net>
Date: Sat Nov 4 20:36:12 2017 +0800
Frontend-GNOME: restore cursor position in MessageTextView
When switching the focus to the chat messages by activating the browser mode via
F7 the position of the cursor will be set to where new messages start, below the
red marker line.
This allows blind persons to keep reading new messages where they left reading
messages.
src/Frontend-GNOME/Views/MessageTextView.cs | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/MessageTextView.cs b/src/Frontend-GNOME/Views/MessageTextView.cs
index e9e1627..ea5df8f 100644
--- a/src/Frontend-GNOME/Views/MessageTextView.cs
+++ b/src/Frontend-GNOME/Views/MessageTextView.cs
@@ -176,6 +176,18 @@ namespace Smuxi.Frontend.Gnome
}
CheckStyle();
};
+ FocusInEvent += (o, args) => {
+ if (_MarkerlineBufferPosition == 0) {
+ return;
+ }
+ // restore the cursor position when entering the focus, for
+ // example by pressing F7. This is useful for blind persons who
+ // use a screen reader like orca to continue reading new unread
+ // messages.
+ var markerIter = Buffer.GetIterAtOffset(_MarkerlineBufferPosition);
+ markerIter.ForwardLine();
+ Buffer.PlaceCursor(markerIter);
+ };
}
public void ApplyConfig(UserConfig config)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]