瀏覽代碼

browse: fix nnn -e (#549)

The current code will start editor if the mime doesn't start with
"text/". But, we want the opposite.

Simplify the check by using `strncmp` instead.

We may improve by writing a helper: `start_withs` in the future.

This change also cleans -Wstrict-aliasing on Ubuntu 16.04 LTS
master
Danh Doan GitHub 4 年之前
父節點
當前提交
e8e87f6ba2
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      src/nnn.c

+ 1
- 1
src/nnn.c 查看文件

@@ -5404,7 +5404,7 @@ nochange:
if (cfg.useeditor && (!sb.st_size ||
#ifdef FILE_MIME_OPTS
(get_output(g_buf, CMD_LEN_MAX, "file", FILE_MIME_OPTS, newpath, FALSE)
&& !(((int *)g_buf)[0] == *(int *)"text" && g_buf[4] == '/')))) {
&& !strncmp(g_buf, "text/", 5)))) {
#else
/* no mime option; guess from description instead */
(get_output(g_buf, CMD_LEN_MAX, "file", "-b", newpath, FALSE)


Loading…
取消
儲存