Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
204
Issues
204
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
05928d59
Commit
05928d59
authored
Aug 07, 2010
by
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13
3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completion is now sorted by last_talked. fixed
#1712
parent
eb36e08e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
30 deletions
+21
-30
src/gui.py
src/gui.py
+8
-19
src/keyboard.py
src/keyboard.py
+0
-5
src/user.py
src/user.py
+3
-2
src/window.py
src/window.py
+10
-4
No files found.
src/gui.py
View file @
05928d59
...
...
@@ -264,28 +264,17 @@ class Gui(object):
"""
def
compare_users
(
a
,
b
):
"""
Used to sort users by their
availability
Used to sort users by their
last_talked
"""
if
a
.
show
==
b
.
show
:
if
not
a
.
last_talked
and
b
.
last_talked
:
return
0
if
a
.
show
is
None
:
elif
not
b
.
last_talked
and
a
.
last_talked
:
return
1
if
a
.
last_talked
<
b
.
last_talked
:
return
1
else
:
return
-
1
return
1
if
len
(
self
.
window
.
input
.
text
)
==
0
:
self
.
last_talked_completion
()
else
:
self
.
window
.
input
.
auto_completion
([
user
.
nick
for
user
in
sorted
(
self
.
current_room
().
users
,
compare_users
)])
def
last_talked_completion
(
self
):
"""
If tab is used while the input is empty, insert the nickname
of the last person who spoke
"""
for
msg
in
self
.
current_room
().
messages
[::
-
1
]:
if
msg
.
nickname
is
not
None
and
msg
.
nickname
!=
self
.
current_room
().
own_nick
:
self
.
window
.
input
.
text
=
msg
.
nickname
+
config
.
get
(
'after_completion'
,
','
)
+
" "
self
.
window
.
input
.
key_end
()
return
self
.
window
.
input
.
auto_completion
([
user
.
nick
for
user
in
sorted
(
self
.
current_room
().
users
,
compare_users
)])
def
last_words_completion
(
self
):
"""
...
...
src/keyboard.py
View file @
05928d59
...
...
@@ -23,8 +23,6 @@ of the time ONE char, but may be longer if it's a keyboard
shortcut, like ^A, M-a or KEY_RESIZE)
"""
from
common
import
debug
def
get_next_byte
(
s
):
"""
Read the next byte of the utf-8 char
...
...
@@ -54,15 +52,12 @@ def read_char(s):
(
first
,
c
)
=
get_next_byte
(
s
)
char
=
"M-"
+
c
if
194
<=
first
:
debug
(
'1
\n
'
)
(
code
,
c
)
=
get_next_byte
(
s
)
# 2 bytes char
char
+=
c
if
224
<=
first
:
debug
(
'2
\n
'
)
(
code
,
c
)
=
get_next_byte
(
s
)
# 3 bytes char
char
+=
c
if
240
<=
first
:
debug
(
'3
\n
'
)
(
code
,
c
)
=
get_next_byte
(
s
)
# 4 bytes char
char
+=
c
return
char
src/user.py
View file @
05928d59
...
...
@@ -59,5 +59,6 @@ class User(object):
return
True
def
__repr__
(
self
):
return
"<user.User object nick:%s show:%s(%s) status:%s affiliation:%s>"
\
%
(
self
.
nick
,
self
.
show
,
type
(
self
.
show
),
self
.
status
,
self
.
affiliation
)
return
">%s<"
%
(
self
.
nick
.
decode
(
'utf-8'
))
# return "<user.User object nick:%s show:%s(%s) status:%s affiliation:%s>"\
# % (self.nick.decode('utf-8'), self.show, type(self.show), self.status, self.affiliation)
src/window.py
View file @
05928d59
...
...
@@ -541,10 +541,10 @@ class Input(Win):
"""
Complete the nickname
"""
if
self
.
pos
+
self
.
line_pos
!=
len
(
self
.
text
)
or
len
(
self
.
text
)
==
0
:
if
self
.
pos
+
self
.
line_pos
!=
len
(
self
.
text
)
:
# or len(self.text) == 0
return
# we don't complete if cursor is not at the end of line
completion_type
=
config
.
get
(
'completion'
,
'normal'
)
if
completion_type
==
'shell'
:
if
completion_type
==
'shell'
and
self
.
text
!=
''
:
self
.
shell_completion
(
user_list
)
else
:
self
.
normal_completion
(
user_list
)
...
...
@@ -567,7 +567,10 @@ class Input(Win):
(
y
,
x
)
=
self
.
win
.
getyx
()
if
not
self
.
last_key_tab
:
# begin is the begining of the nick we want to complete
begin
=
self
.
text
.
split
()[
-
1
].
encode
(
'utf-8'
).
lower
()
if
self
.
text
!=
''
:
begin
=
self
.
text
.
split
()[
-
1
].
encode
(
'utf-8'
).
lower
()
else
:
begin
=
''
hit_list
=
[]
# list of matching nicks
for
user
in
user_list
:
if
user
.
lower
().
startswith
(
begin
):
...
...
@@ -595,7 +598,10 @@ class Input(Win):
else
:
after
=
config
.
get
(
'after_completion'
,
','
)
+
" "
(
y
,
x
)
=
self
.
win
.
getyx
()
begin
=
self
.
text
.
split
()[
-
1
].
encode
(
'utf-8'
).
lower
()
if
self
.
text
!=
''
:
begin
=
self
.
text
.
split
()[
-
1
].
encode
(
'utf-8'
).
lower
()
else
:
begin
=
''
hit_list
=
[]
# list of matching nicks
for
user
in
user_list
:
if
user
.
lower
().
startswith
(
begin
):
...
...
louiz’
@louiz
mentioned in issue
#1928 (closed)
·
Aug 21, 2018
mentioned in issue
#1928 (closed)
mentioned in issue #1928
Toggle commit list
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