Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
c351b76f
Commit
c351b76f
authored
Sep 11, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another fix for the recall buffer.
parent
0f850db9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
27 deletions
+25
-27
xtt/lib/cow/gtk/cow_wow_gtk.cpp
xtt/lib/cow/gtk/cow_wow_gtk.cpp
+11
-13
xtt/lib/cow/qt/cow_wow_qt.cqt
xtt/lib/cow/qt/cow_wow_qt.cqt
+5
-7
xtt/lib/cow/src/cow_wow.cpp
xtt/lib/cow/src/cow_wow.cpp
+9
-7
No files found.
xtt/lib/cow/gtk/cow_wow_gtk.cpp
View file @
c351b76f
...
...
@@ -1108,28 +1108,26 @@ gboolean CoWowEntryGtk::event_cb(GtkWidget* w, GdkEvent* event, gpointer data)
case
GDK_KP_Enter
:
case
GDK_Linefeed
:
{
// Insert in recall buffer
en
->
m_re
->
push
(
text
);
if
(
!
streq
(
text
,
""
))
{
en
->
m_re
->
push
(
text
);
}
break
;
}
case
GDK_Up
:
{
const
char
*
prev
=
en
->
m_re
->
popUp
(
text
);
if
(
!
streq
(
prev
,
""
))
{
gint
pos
=
0
;
gtk_editable_delete_text
(
GTK_EDITABLE
(
w
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
w
),
prev
,
strlen
(
prev
),
&
pos
);
gtk_editable_set_position
(
GTK_EDITABLE
(
w
),
-
1
);
}
gint
pos
=
0
;
gtk_editable_delete_text
(
GTK_EDITABLE
(
w
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
w
),
prev
,
strlen
(
prev
),
&
pos
);
gtk_editable_set_position
(
GTK_EDITABLE
(
w
),
-
1
);
sts
=
TRUE
;
break
;
}
case
GDK_Down
:
{
const
char
*
next
=
en
->
m_re
->
popDown
(
text
);
if
(
!
streq
(
next
,
""
))
{
gint
pos
=
0
;
gtk_editable_delete_text
(
GTK_EDITABLE
(
w
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
w
),
next
,
strlen
(
next
),
&
pos
);
gtk_editable_set_position
(
GTK_EDITABLE
(
w
),
-
1
);
}
gint
pos
=
0
;
gtk_editable_delete_text
(
GTK_EDITABLE
(
w
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
w
),
next
,
strlen
(
next
),
&
pos
);
gtk_editable_set_position
(
GTK_EDITABLE
(
w
),
-
1
);
sts
=
TRUE
;
break
;
}
...
...
xtt/lib/cow/qt/cow_wow_qt.cqt
View file @
c351b76f
...
...
@@ -656,22 +656,20 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
case Qt::Key_Return:
case Qt::Key_Enter: {
// Insert in recall buffer
m_re->push(qPrintable(text()));
if (!text().isEmpty()) {
m_re->push(qPrintable(text()));
}
break;
}
case Qt::Key_Up: {
const char* prev = m_re->popUp(qPrintable(text()));
if (!streq(prev, "")) {
setText(fl(prev));
}
setText(fl(prev));
end(false);
break;
}
case Qt::Key_Down: {
const char* next = m_re->popDown(qPrintable(text()));
if (!streq(next, "")) {
setText(fl(next));
}
setText(fl(next));
end(false);
break;
}
...
...
xtt/lib/cow/src/cow_wow.cpp
View file @
c351b76f
...
...
@@ -69,16 +69,18 @@ CoWowRecall::CoWowRecall() : m_current_recall_line(0), m_current_size(0)
void
CoWowRecall
::
push
(
const
char
*
src
)
{
if
(
!
streq
(
src
,
""
)
&&
!
streq
(
src
,
m_recall
[
0
]))
{
for
(
int
i
=
m_recall_size
-
2
;
i
>=
0
;
i
--
)
{
strcpy
(
m_recall
[
i
+
1
],
m_recall
[
i
]);
if
(
!
streq
(
src
,
m_recall
[
0
]))
{
if
(
m_current_size
==
0
||
!
streq
(
m_recall
[
0
],
""
))
{
for
(
int
i
=
m_recall_size
-
2
;
i
>=
0
;
i
--
)
{
strcpy
(
m_recall
[
i
+
1
],
m_recall
[
i
]);
}
m_current_size
++
;
if
(
m_current_size
>
m_recall_size
)
{
m_current_size
=
m_recall_size
;
}
}
strncpy
(
m_recall
[
0
],
src
,
m_line_size
);
m_recall
[
0
][
m_line_size
-
1
]
=
0
;
m_current_size
++
;
if
(
m_current_size
>
m_recall_size
)
{
m_current_size
=
m_recall_size
;
}
}
resetTmp
();
}
...
...
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