mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
fix long file name
This commit is contained in:
parent
90ed1f797e
commit
319a403082
1 changed files with 9 additions and 2 deletions
|
@ -1698,7 +1698,12 @@ func (c *Client) recipientGetFileReady(finished bool) (err error) {
|
||||||
c.Step3RecipientRequestFile = true
|
c.Step3RecipientRequestFile = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func max(a int, b int) int {
|
||||||
|
if a > b {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error) {
|
func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error) {
|
||||||
log.Debugf("touching file with folder / name")
|
log.Debugf("touching file with folder / name")
|
||||||
if !utils.Exists(fileInfo.FolderRemote) {
|
if !utils.Exists(fileInfo.FolderRemote) {
|
||||||
|
@ -1737,6 +1742,7 @@ func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error)
|
||||||
description = " " + description
|
description = " " + description
|
||||||
}
|
}
|
||||||
width, _, err := term.GetSize(int(os.Stdout.Fd()))
|
width, _, err := term.GetSize(int(os.Stdout.Fd()))
|
||||||
|
width = max(20, width-70)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1923,9 +1929,10 @@ func (c *Client) setBar() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
width = max(20, width-70)
|
||||||
description = strings.TrimSpace(description)
|
description = strings.TrimSpace(description)
|
||||||
if len(description) > width {
|
if len(description) > width {
|
||||||
description = description[:(width-3)] + "..."
|
description = description[:width-3] + "..."
|
||||||
}
|
}
|
||||||
c.bar = progressbar.NewOptions64(
|
c.bar = progressbar.NewOptions64(
|
||||||
c.FilesToTransfer[c.FilesToTransferCurrentNum].Size,
|
c.FilesToTransfer[c.FilesToTransferCurrentNum].Size,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue