improve padding

This commit is contained in:
Laura Hausmann 2019-12-14 20:54:53 +01:00
parent 74fefd9d7b
commit 132334bedd
Signed by: zotan
GPG key ID: 5EC1D38FFC321311
3 changed files with 5 additions and 5 deletions

View file

@ -130,7 +130,6 @@ namespace telegram
else if (chat.UnreadCount > 0)
{
var unreads = GetHistory(chatId, chat.UnreadCount);
Console.WriteLine(unreads.Count);
var rest = GetHistory(chatId, 5 - unreads.Count, unreads.First().Id);
rest.ForEach(AddMessageToQueue);
messageQueue.Add($"{Ansi.Yellow}[tgcli] ---UNREAD---");
@ -204,7 +203,6 @@ namespace telegram
else if (chat.UnreadCount > 0)
{
var unreads = GetHistory(chat.Id, chat.UnreadCount);
Console.WriteLine(unreads.Count);
var rest = GetHistory(chat.Id, 5 - unreads.Count, unreads.First().Id);
rest.ForEach(AddMessageToQueue);
messageQueue.Add($"{Ansi.Yellow}[tgcli] ---UNREAD---");

View file

@ -380,7 +380,7 @@ namespace telegram
return results.ChatIds.First(p =>
GetChat(p).Type is ChatType.ChatTypePrivate type &&
GetUser(type.UserId).Username == query.Substring(1));
return results.ChatIds.First();
return results.ChatIds.First(p => !(GetChat(p).Type is ChatType.ChatTypeSecret));
}
catch
{
@ -495,7 +495,7 @@ namespace telegram
maxLen = 2;
if (input.Contains("⏎"))
input = "⏎" + input.Split("⏎").Last();
return input.Length <= maxLen ? input : "<" + input.Substring(input.Length - maxLen + 1);
return input.Length < maxLen ? input : "<" + input.Substring(input.Length - maxLen + 2);
}
public static readonly List<Tuple<string, string>> Emojis = new List<Tuple<string, string>>

View file

@ -14,6 +14,8 @@ namespace telegram
{
/*
* TODO:
* fuzzy matching for replies?
* unreads are unreliable in secret chats!
* mute,unmute chats
* photo & document download & show externally
* publish AUR package
@ -212,7 +214,7 @@ namespace telegram
else
output += "]";
output += " > ";
output += TruncateMessageStart(currentInputLine, Console.LargestWindowWidth - output.Length);
output += TruncateMessageStart(currentInputLine, Console.LargestWindowWidth - GetActualStringWidth(output));
Console.Write(output);
}
}