elvirbrk / NoteHighlight2016

Source code syntax highlighting for OneNote 2016 and OneNote for O365 . NoteHighlight 2013 port for OneNote 2016 (32-bit and 64-bit)
GNU General Public License v2.0
3.84k stars 393 forks source link

Close curly '}' loses when copying large piece of code #73

Open TianYuanSX opened 6 years ago

TianYuanSX commented 6 years ago

Thanks for your dedicated work and this tool helps me a lot when I use OneNote for learning coding. However, sometimes it doesn't work well, especially when I am coping a large piece of code including some {}, the example like this

image The } at the end of the code will lose and this problem recurs several times.

Hope this will improve in the coming version.

elvirbrk commented 6 years ago

Please attach that code sample as txt file so I can use it as test case.

TianYuanSX commented 6 years ago

Here is the text edition. It will lose the last '}' with OneNote 2016 64bit zh-cn

public static void copy(File[] files, File dst) { if (!dst.exists()) {// 不存在文件夹的话自动创建 dst.mkdirs(); } for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { FileInputStream fin = null; FileOutputStream fout = null; try { fin = new FileInputStream(files[i]); fout = new FileOutputStream(new File(dst.getPath() + File.separator + files[i].getName()));// 创建要目的地的文件名称 byte[] buffers = new byte[512]; int numberRead = 0; while ((numberRead = fin.read(buffers)) != -1) { fout.write(buffers, 0, numberRead);// 进行复制操作 } fin.close(); fout.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); }

        } else if (files[i].isDirectory()) {
            File newPath = new File(dst.getPath() + File.separator + files[i].getName());
            // 如果是文件夹的话,进一步访问下一级目录,开始新一轮迭代
            copy(files[i].listFiles(), newPath);
        }
    }
}
elvirbrk commented 5 years ago

Not able to reproduce if I only paste this text. Please make sample OneNote page where you are having this issue and attach it here.