Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marten/enhanced chat history browsing #857

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions Scripts/Python/ki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,8 @@ def MessageHistory(self, control, set):

if (set == "up"):
if (self.chatMgr.MessageHistoryIs < len(self.chatMgr.MessageHistoryList)-1):
if (self.chatMgr.MessageHistoryIs == -1):
self.chatMgr.MessageCurrentLine = control.getString()
self.chatMgr.MessageHistoryIs = self.chatMgr.MessageHistoryIs +1
control.setStringW(self.chatMgr.MessageHistoryList[self.chatMgr.MessageHistoryIs])
control.end()
Expand All @@ -1671,6 +1673,11 @@ def MessageHistory(self, control, set):
control.setStringW(self.chatMgr.MessageHistoryList[self.chatMgr.MessageHistoryIs])
control.end()
control.refresh()
elif (self.chatMgr.MessageHistoryIs == 0):
self.chatMgr.MessageHistoryIs = -1
control.setStringW(self.chatMgr.MessageCurrentLine)
control.end()
control.refresh()

#~~~~~~~~~~#
# GZ Games #
Expand Down Expand Up @@ -5520,6 +5527,15 @@ def ProcessNotifyMicro(self, control, event):
ctrlID = control.getTagID()
if ctrlID == kGUI.ChatEditboxID:
self.Autocomplete(control)
# Up or Down key to scroll in the chat history
elif event == kMessageHistoryUp:
ctrlID = control.getTagID()
if ctrlID == kGUI.ChatEditboxID:
self.MessageHistory(control, "up")
elif event == kMessageHistoryDown:
ctrlID = control.getTagID()
if ctrlID == kGUI.ChatEditboxID:
self.MessageHistory(control, "down")
Hoikas marked this conversation as resolved.
Show resolved Hide resolved

## Process notifications originating from the miniKI.
# The miniKI is the display in the top-left corner of the screen (by
Expand Down
1 change: 1 addition & 0 deletions Scripts/Python/ki/xKIChat.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init__(self, StartFadeTimer, ResetFadeState, FadeCompletely, GetCensorLeve
# Message History
self.MessageHistoryIs = -1 # Current position in message history (up/down key)
self.MessageHistoryList = [] # Contains our message history
self.MessageCurrentLine = "" # Hold current line while navigating message history

#######
# GUI #
Expand Down