Repository navigation
Add tail toggle button to toolbar - #421
Open
MahdiHamidpour wants to merge 2 commits into
Open
MahdiHamidpour wants to merge 2 commits into
MahdiHamidpour wants to merge 2 commits into
Conversation
Add a check-style "Follow remote file (tail)" button to the plugin toolbar as the first step towards issue ashkulz#330. - New toolbar bitmap toolbar_tail.bmp (16x16, 8-bit, same style and background colour as the existing toolbar icons) - New IDs IDB_BITMAP_TAIL (118) and IDB_BUTTON_TOOLBAR_TAIL (510) - Button is enabled only while connected and a file is selected - Toggling stores the state in FTPWindow::m_tailEnabled - State is reset when the session disconnects The polling/append logic itself will follow in a separate commit.
When the toolbar tail button is enabled for the selected remote file,
NppFTP downloads it once into the cache, opens it in Notepad++ and then
polls the server every 2 seconds, fetching only the bytes added since
the previous poll.
- FTPClientWrapper: new GetRemoteSize() and ReceiveFileFrom(offset)
- FTP/FTPS: SIZE, and REST + RETR via UTCP ResumeReceiveFile with a
new AppendHandleDataSource
- SFTP: sftp_stat, and sftp_seek64 + sftp_read
- New QueueTail operation on the transfer queue (always binary mode so
local and remote offsets match). If the remote file becomes smaller
(truncated or rotated) it is downloaded again from the start.
- FTPWindow: Start/Stop/PollTail driven by a WM_TIMER; new data is
written to the cache file, the document is reloaded silently and
scrolled to the end if it is the active one. Results of a stopped
tail session are ignored (generation counter).
- Tail stops on disconnect, on error and when the plugin window is
destroyed. The button stays enabled while tailing so it can always
be switched off.
- Saving the followed file does not upload it, so the remote log
cannot be overwritten with an outdated copy.
MahdiHamidpour
marked this pull request as ready for review
November 23, 2026 14:11
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add tail (follow remote file) feature
Closes #330
This adds a "Follow remote file (tail)" toggle to the NppFTP toolbar. When it is enabled for the selected remote file, NppFTP keeps the local copy in sync with the server, similar to
tail -f.How it works
Changes
toolbar_tail.bmp, 16x16, 8-bit, same style as the existing icons). It is enabled when a file is selected, and stays enabled while tailing so it can always be switched off.FTPClientWrapper: two new methods, implemented for both backends:GetRemoteSize():SIZEfor FTP/FTPS,sftp_statfor SFTPReceiveFileFrom(offset):REST+RETR(through UTCP'sResumeReceiveFileand a newAppendHandleDataSource) for FTP/FTPS,sftp_seek64+sftp_readfor SFTPQueueTail: new operation on the transfer queue. It always uses binary mode so local and remote offsets match.FTPWindow: tail session handling (start/stop/poll on aWM_TIMER). Results of a stopped session are ignored. Tailing stops on disconnect, on error, or when the window is destroyed.Known limitations
longfor sizes/offsets).Testing
echo test >> file.log) and check they appear> file.log) and check it is reloaded from the start