Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
G
geany
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
geany
Commits
44eecc25
Kaydet (Commit)
44eecc25
authored
Ock 28, 2015
tarafından
Colomban Wendling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #187 from artros/bug/clear-redo-on-edit
Clear redo stack on edit
üst
526294d7
1b1a1da4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
document.c
src/document.c
+30
-24
No files found.
src/document.c
Dosyayı görüntüle @
44eecc25
...
...
@@ -122,7 +122,9 @@ enum
static
guint
doc_id_counter
=
0
;
static
void
document_undo_clear_stack
(
GTrashStack
**
stack
);
static
void
document_undo_clear
(
GeanyDocument
*
doc
);
static
void
document_undo_add_internal
(
GeanyDocument
*
doc
,
guint
type
,
gpointer
data
);
static
void
document_redo_add
(
GeanyDocument
*
doc
,
guint
type
,
gpointer
data
);
static
gboolean
remove_page
(
guint
page_num
);
static
GtkWidget
*
document_show_message
(
GeanyDocument
*
doc
,
GtkMessageType
msgtype
,
...
...
@@ -2701,14 +2703,14 @@ void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding)
* to the encoding or the Unicode BOM (which are Scintilla independet).
* All Scintilla events are stored in the undo / redo buffer and are passed through. */
/* Clears
the Undo and Redo buffer (to be called when reloading or closing the document)
*/
void
document_undo_clear
(
GeanyDocument
*
doc
)
/* Clears
an Undo or Redo buffer.
*/
void
document_undo_clear
_stack
(
GTrashStack
**
stack
)
{
undo_action
*
a
;
while
(
g_trash_stack_height
(
&
doc
->
priv
->
undo_actions
)
>
0
)
while
(
g_trash_stack_height
(
stack
)
>
0
)
{
a
=
g_trash_stack_pop
(
&
doc
->
priv
->
undo_actions
);
a
=
g_trash_stack_pop
(
stack
);
if
(
G_LIKELY
(
a
!=
NULL
))
{
switch
(
a
->
type
)
...
...
@@ -2719,30 +2721,25 @@ void document_undo_clear(GeanyDocument *doc)
g_free
(
a
);
}
}
doc
->
priv
->
undo_actions
=
NULL
;
*
stack
=
NULL
;
}
while
(
g_trash_stack_height
(
&
doc
->
priv
->
redo_actions
)
>
0
)
{
a
=
g_trash_stack_pop
(
&
doc
->
priv
->
redo_actions
);
if
(
G_LIKELY
(
a
!=
NULL
))
{
switch
(
a
->
type
)
{
case
UNDO_ENCODING
:
g_free
(
a
->
data
);
break
;
default:
break
;
}
g_free
(
a
);
}
}
doc
->
priv
->
redo_actions
=
NULL
;
/* Clears the Undo and Redo buffer (to be called when reloading or closing the document) */
void
document_undo_clear
(
GeanyDocument
*
doc
)
{
document_undo_clear_stack
(
&
doc
->
priv
->
undo_actions
);
document_undo_clear_stack
(
&
doc
->
priv
->
redo_actions
);
if
(
!
main_status
.
quitting
&&
doc
->
editor
!=
NULL
)
document_set_text_changed
(
doc
,
FALSE
);
}
/* note: this is called on SCN_MODIFIED notifications */
void
document_undo_add
(
GeanyDocument
*
doc
,
guint
type
,
gpointer
data
)
/* Adds an undo action without clearing the redo stack. This function should
* not be called directly, generally (use document_undo_add() instead), but is
* used by document_redo() in order not to erase the redo stack while moving
* an action from the redo stack to the undo stack. */
void
document_undo_add_internal
(
GeanyDocument
*
doc
,
guint
type
,
gpointer
data
)
{
undo_action
*
action
;
...
...
@@ -2761,6 +2758,15 @@ void document_undo_add(GeanyDocument *doc, guint type, gpointer data)
ui_update_popup_reundo_items
(
doc
);
}
/* note: this is called on SCN_MODIFIED notifications */
void
document_undo_add
(
GeanyDocument
*
doc
,
guint
type
,
gpointer
data
)
{
/* Clear the redo actions stack before adding the undo action. */
document_undo_clear_stack
(
&
doc
->
priv
->
redo_actions
);
document_undo_add_internal
(
doc
,
type
,
data
);
}
gboolean
document_can_undo
(
GeanyDocument
*
doc
)
{
...
...
@@ -2872,14 +2878,14 @@ void document_redo(GeanyDocument *doc)
{
case
UNDO_SCINTILLA
:
{
document_undo_add
(
doc
,
UNDO_SCINTILLA
,
NULL
);
document_undo_add
_internal
(
doc
,
UNDO_SCINTILLA
,
NULL
);
sci_redo
(
doc
->
editor
->
sci
);
break
;
}
case
UNDO_BOM
:
{
document_undo_add
(
doc
,
UNDO_BOM
,
GINT_TO_POINTER
(
doc
->
has_bom
));
document_undo_add
_internal
(
doc
,
UNDO_BOM
,
GINT_TO_POINTER
(
doc
->
has_bom
));
doc
->
has_bom
=
GPOINTER_TO_INT
(
action
->
data
);
ui_update_statusbar
(
doc
,
-
1
);
...
...
@@ -2888,7 +2894,7 @@ void document_redo(GeanyDocument *doc)
}
case
UNDO_ENCODING
:
{
document_undo_add
(
doc
,
UNDO_ENCODING
,
g_strdup
(
doc
->
encoding
));
document_undo_add
_internal
(
doc
,
UNDO_ENCODING
,
g_strdup
(
doc
->
encoding
));
document_set_encoding
(
doc
,
(
const
gchar
*
)
action
->
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment