mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 10:36:44 +00:00
Add machine.title length checks (#4)
Setting an empty string resets the title, setting a string longer than 256 characters truncates it.
This commit is contained in:
parent
5045fa757c
commit
2f701a6338
1 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
// This file is part of Capy64 - https://github.com/Capy64/Capy64
|
||||
// This file is part of Capy64 - https://github.com/Capy64/Capy64
|
||||
// Copyright 2023 Alessandro "AlexDevs" Proto
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License").
|
||||
|
@ -103,6 +103,13 @@ public class Machine : IPlugin
|
|||
if (!L.IsNoneOrNil(1))
|
||||
{
|
||||
var newTitle = L.CheckString(1);
|
||||
|
||||
if (string.IsNullOrEmpty(newTitle))
|
||||
{
|
||||
newTitle = "Capy64 " + Capy64.Version;
|
||||
}
|
||||
|
||||
newTitle = newTitle[..Math.Min(newTitle.Length, 256)];
|
||||
|
||||
Capy64.Instance.Window.Title = newTitle;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue