mirror of https://github.com/zlatinb/muwire
update room scrollback limit to new api, update TODO
parent
ad8693d512
commit
ac8d9c1281
1
TODO.md
1
TODO.md
|
@ -25,7 +25,6 @@ This helps with scalability
|
||||||
### Chat
|
### Chat
|
||||||
* echo "unknown/innappropriate command" in the console
|
* echo "unknown/innappropriate command" in the console
|
||||||
* break up lines on CR/LF, send multiple messages
|
* break up lines on CR/LF, send multiple messages
|
||||||
* Style timestamps and persona names
|
|
||||||
* enforce # in room names or ignore it
|
* enforce # in room names or ignore it
|
||||||
* auto-create/join channel on server start
|
* auto-create/join channel on server start
|
||||||
* jump from notification window to room with message
|
* jump from notification window to room with message
|
||||||
|
|
|
@ -246,12 +246,8 @@ class ChatRoomController {
|
||||||
private void trimLines() {
|
private void trimLines() {
|
||||||
if (model.settings.maxChatLines < 0)
|
if (model.settings.maxChatLines < 0)
|
||||||
return
|
return
|
||||||
// TODO: update to JTextPane api
|
while(view.getLineCount() > model.settings.maxChatLines)
|
||||||
// while(view.roomTextArea.getLineCount() > model.settings.maxChatLines) {
|
view.removeFirstLine()
|
||||||
// int line0Start = view.roomTextArea.getLineStartOffset(0)
|
|
||||||
// int line0End = view.roomTextArea.getLineEndOffset(0)
|
|
||||||
// view.roomTextArea.replaceRange(null, line0Start, line0End)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rejoinRoom() {
|
void rejoinRoom() {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import javax.swing.JSplitPane
|
||||||
import javax.swing.JTextPane
|
import javax.swing.JTextPane
|
||||||
import javax.swing.ListSelectionModel
|
import javax.swing.ListSelectionModel
|
||||||
import javax.swing.SwingConstants
|
import javax.swing.SwingConstants
|
||||||
|
import javax.swing.text.Element
|
||||||
import javax.swing.text.Style
|
import javax.swing.text.Style
|
||||||
import javax.swing.text.StyleConstants
|
import javax.swing.text.StyleConstants
|
||||||
import javax.swing.text.StyleContext
|
import javax.swing.text.StyleContext
|
||||||
|
@ -208,4 +209,15 @@ class ChatRoomView {
|
||||||
doc.insertString(doc.getEndPosition().getOffset() - 1, text, doc.getStyle("regular"))
|
doc.insertString(doc.getEndPosition().getOffset() - 1, text, doc.getStyle("regular"))
|
||||||
doc.insertString(doc.getEndPosition().getOffset() - 1, "\n", doc.getStyle("regular"))
|
doc.insertString(doc.getEndPosition().getOffset() - 1, "\n", doc.getStyle("regular"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getLineCount() {
|
||||||
|
StyledDocument doc = roomTextArea.getStyledDocument()
|
||||||
|
doc.getDefaultRootElement().getElementCount() - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeFirstLine() {
|
||||||
|
StyledDocument doc = roomTextArea.getStyledDocument()
|
||||||
|
Element element = doc.getParagraphElement(0)
|
||||||
|
doc.remove(0, element.getEndOffset())
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue