Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KMuddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
Games
KMuddy
Commits
9ffa69e1
Commit
9ffa69e1
authored
May 25, 2019
by
Tomas Mecir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't spam NAWS all the time
parent
faa01e04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
38 deletions
+40
-38
kmuddy/ctelnet.cpp
kmuddy/ctelnet.cpp
+31
-30
libs/cconsole.cpp
libs/cconsole.cpp
+8
-7
libs/cconsole.h
libs/cconsole.h
+1
-1
No files found.
kmuddy/ctelnet.cpp
View file @
9ffa69e1
...
...
@@ -293,6 +293,9 @@ void cTelnet::reset ()
//reset telnet status
d
->
iac
=
d
->
iac2
=
d
->
insb
=
false
;
d
->
command
=
""
;
// reset these so that we report dimensions correctly
d
->
curX
=
0
;
d
->
curY
=
0
;
}
void
cTelnet
::
socketConnected
()
...
...
@@ -519,39 +522,37 @@ void cTelnet::windowSizeChanged (int x, int y)
//remember the size - we'll need it if NAWS is currently disabled but will
//be enabled. Also remember it if no connection exists at the moment;
//we won't be called again when connecting
d
->
curX
=
x
;
d
->
curY
=
y
;
if
(
!
(
isConnected
()))
return
;
if
(
d
->
myOptionState
[
OPT_NAWS
])
//only if we have negotiated this option
{
string
s
;
s
=
TN_IAC
;
s
+=
TN_SB
;
s
+=
OPT_NAWS
;
unsigned
char
x1
,
x2
,
y1
,
y2
;
x1
=
(
unsigned
char
)
x
/
256
;
x2
=
(
unsigned
char
)
x
%
256
;
y1
=
(
unsigned
char
)
y
/
256
;
y2
=
(
unsigned
char
)
y
%
256
;
//IAC must be doubled
s
+=
x1
;
if
(
x1
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
x2
;
if
(
x2
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
y1
;
if
(
y1
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
y2
;
if
(
y2
==
TN_IAC
)
s
+=
TN_IAC
;
if
(
!
d
->
myOptionState
[
OPT_NAWS
])
return
;
//only if we have negotiated this option
if
((
x
==
d
->
curX
)
&&
(
y
==
d
->
curY
))
return
;
// don't spam sizes if we have sent the current one already
string
s
;
s
=
TN_IAC
;
s
+=
TN_SB
;
s
+=
OPT_NAWS
;
unsigned
char
x1
,
x2
,
y1
,
y2
;
x1
=
(
unsigned
char
)
x
/
256
;
x2
=
(
unsigned
char
)
x
%
256
;
y1
=
(
unsigned
char
)
y
/
256
;
y2
=
(
unsigned
char
)
y
%
256
;
//IAC must be doubled
s
+=
x1
;
if
(
x1
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
TN_SE
;
doSendData
(
s
);
}
s
+=
x2
;
if
(
x2
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
y1
;
if
(
y1
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
y2
;
if
(
y2
==
TN_IAC
)
s
+=
TN_IAC
;
s
+=
TN_IAC
;
s
+=
TN_SE
;
doSendData
(
s
);
}
void
cTelnet
::
sendTelnetOption
(
unsigned
char
type
,
unsigned
char
option
)
...
...
libs/cconsole.cpp
View file @
9ffa69e1
...
...
@@ -218,7 +218,7 @@ cConsole::cConsole(QWidget *parent) : QGraphicsView(parent) {
viewport
()
->
setCursor
(
Qt
::
IBeamCursor
);
forceBeginOfLine
();
fixupOutput
();
fixupOutput
(
true
);
}
cConsole
::~
cConsole
()
{
...
...
@@ -242,7 +242,7 @@ void cConsole::setFont (QFont f) {
d
->
charWidth
=
fm
.
width
(
"m"
);
d
->
charHeight
=
fm
.
lineSpacing
()
+
2
;
fixupOutput
();
fixupOutput
(
true
);
}
QFont
cConsole
::
font
()
{
...
...
@@ -415,7 +415,7 @@ void cConsole::addNewText (cTextChunk *chunk, bool endTheLine)
if
(
!
d
->
atBottom
)
bar
->
setValue
(
bar
->
value
()
-
fheight
);
}
fixupOutput
();
fixupOutput
(
false
);
}
void
cConsole
::
forceBeginOfLine
()
{
...
...
@@ -459,14 +459,14 @@ void cConsole::pageDown () {
void
cConsole
::
resizeEvent
(
QResizeEvent
*
)
{
fixupOutput
();
fixupOutput
(
true
);
}
// this is needed to resize the text display at startup
bool
cConsole
::
viewportEvent
(
QEvent
*
event
)
{
if
(
event
->
type
()
==
QEvent
::
Resize
)
fixupOutput
();
fixupOutput
(
true
);
return
QGraphicsView
::
viewportEvent
(
event
);
}
...
...
@@ -493,7 +493,7 @@ void cConsole::scrollContentsBy (int dx, int dy)
adjustScrollBack
();
}
void
cConsole
::
fixupOutput
()
void
cConsole
::
fixupOutput
(
bool
sizeChanged
)
{
double
h
=
max
((
qreal
)
viewport
()
->
height
(),
d
->
text
->
documentLayout
()
->
documentSize
().
height
());
scene
()
->
setSceneRect
(
0
,
0
,
viewport
()
->
width
(),
h
);
...
...
@@ -503,7 +503,8 @@ void cConsole::fixupOutput ()
d
->
scrollText
->
updateSize
();
adjustScrollBack
();
forceEmitSize
();
if
(
sizeChanged
)
forceEmitSize
();
}
void
cConsole
::
linkHovered
(
const
QString
&
link
)
...
...
libs/cconsole.h
View file @
9ffa69e1
...
...
@@ -116,7 +116,7 @@ protected:
bool
viewportEvent
(
QEvent
*
event
)
override
;
virtual
void
scrollContentsBy
(
int
dx
,
int
dy
)
override
;
/** called when resizing and when changing font */
void
fixupOutput
();
void
fixupOutput
(
bool
sizeChanged
=
false
);
void
adjustScrollBack
();
void
addNewText
(
cTextChunk
*
chunk
,
bool
endTheLine
);
...
...
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