[gnote/stable-0.8] Fix slection deletion and remembering it
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/stable-0.8] Fix slection deletion and remembering it
- Date: Sun, 4 Mar 2012 20:04:17 +0000 (UTC)
commit 1cd5050195f378502ea6165da779eb63791e5973
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sun Mar 4 21:54:57 2012 +0200
Fix slection deletion and remembering it
When some text is selected in note and deleted using delete or backspace
key with no other modification or cursor movement, after Gnote restart the
text at the same position is selected (should be cursor in the position,
where previous selection started).
src/note.hpp | 6 +++---
src/notebuffer.cpp | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/note.hpp b/src/note.hpp
index 62480f9..28395d1 100644
--- a/src/note.hpp
+++ b/src/note.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -56,6 +56,8 @@ class NoteData
{
public:
typedef std::map<std::string, Tag::Ptr> TagMap;
+ static const int s_noPosition;
+
NoteData(const std::string & _uri);
const std::string & uri() const
@@ -186,8 +188,6 @@ private:
bool m_open_on_startup;
TagMap m_tags;
-
- static const int s_noPosition;
};
diff --git a/src/notebuffer.cpp b/src/notebuffer.cpp
index df223f3..b1b6e97 100644
--- a/src/notebuffer.cpp
+++ b/src/notebuffer.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2011 Aurimas Cernius
+ * Copyright (C) 2010-2012 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -541,6 +541,8 @@ namespace gnote {
if (selection) {
augment_selection(start, end_iter);
erase(start, end_iter);
+ m_note.data().set_cursor_position(get_insert()->get_iter().get_offset());
+ m_note.data().set_selection_bound_position(NoteData::s_noPosition);
return true;
}
else if (start.ends_line() && start.get_line() < get_line_count()) {
@@ -590,6 +592,8 @@ namespace gnote {
if (selection) {
augment_selection(start, end_iter);
erase(start, end_iter);
+ m_note.data().set_cursor_position(get_insert()->get_iter().get_offset());
+ m_note.data().set_selection_bound_position(NoteData::s_noPosition);
return true;
}
else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]