Don't send empty commands, use angular model instead of accessing element value directly. Fixes problem with pressing enter will send previous value in history.
Let me tell the story backwards:
For some reason, only one line would be fetched in `fetchMoreLines`, but
neither `numLines` nor `buffer.requestedLines` were `undefined`. The
paramater `numLines` must have had some strange value, though.
`connection.fetchMoreLines` is invoked through the main controllers
`$scope.fetchMoreLines`, which sets the parameter to `$scope.lines` if it was
undefined before. That value is computed in `$scope.calculateNumLines`,
which takes the height of the lines area and divides it by the height of the first
bufferline. This computation is retriggered on every `resize` event.
The first bufferline is the 'fetch more lines' link at the top of the window. If the
currently active buffer doesn't have more lines, it is hidden with `ngHide`,
causing its `clientHeight` property to be `0`, and the number of lines to be
fetched `$scope.lines = Infinity` (due to a division by zero).
In `connection.fetchMoreLines`, the following request is then made:
`"buffer:0x" + buffer.id + "/own_lines/last_line(-" + numLines + ")/data"`
to which WeeChat responds with one line. Voilà, there's your mess.
The old one missed a few, two on the input and the one in the title.
This version also doesn't use jQuery
From: http://stackoverflow.com/a/18539624 by StackOverflow user "plantian"
Right now we are only checking the width screen so we are not
detecting anything that is mobile specific. Will rename to
isMobileDevice when we introduce more specific checks.
Showing the keyboard on mobile will trigger a resize event, therefore
trying to use the bufferlist filter will actually hide the bufferlist
making the feature unusable. Bug introduced by 554b1669.
Partially fixes#139 in that it tries to accomplish this, but until we can request
only non-filtered lines from WeeChat, the best thing we can do is guessing.
An invalid pointer will crash WeeChat, while an invalid name will not. A pointer
becomes invalid e.g. if the buffer is closed by another client, g-b not updated,
and the buffer then selected in g-b.
Nicklist is not nearly as important as the actual lines, load them first for better perceived performance. Parsing the nicklist can take a noticeable amount of time for channels with thousands of occupants.
This also improves/fixes the nicklist emptiness check